package com.mm.cloth.model.response;

import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;

/**
 * 服务器登录响应模型类
 * 对应服务器登录接口的实际响应数据结构
 */
public class ServerLoginResponse {
    
    @SerializedName("user")
    @Expose
    private User user;          // 用户信息
    
    @SerializedName("token")
    @Expose
    private String token;       // 认证令牌
    
    // Constructors
    public ServerLoginResponse() {
    }
    
    // Getters and Setters
    public User getUser() {
        return user;
    }
    
    public void setUser(User user) {
        this.user = user;
    }
    
    public String getToken() {
        return token;
    }
    
    public void setToken(String token) {
        this.token = token;
    }
    
    @Override
    public String toString() {
        return "ServerLoginResponse{" +
                "user=" + user +
                ", token='" + token + '\'' +
                '}';
    }
    
    /**
     * 包装类，用于处理服务器响应结构
     * 服务器返回的结构是 { "code": 200, "message": "success", "data": { ... } }
     * 其中data字段的内容才是我们真正需要的ServerLoginResponse对象
     */
    public static class Wrapper {
        @SerializedName("code")
        private int code;
        
        @SerializedName("message")
        private String message;
        
        @SerializedName("data")
        private ServerLoginResponse data;
        
        public Wrapper() {
        }
        
        public int getCode() {
            return code;
        }
        
        public void setCode(int code) {
            this.code = code;
        }
        
        public String getMessage() {
            return message;
        }
        
        public void setMessage(String message) {
            this.message = message;
        }
        
        public ServerLoginResponse getData() {
            return data;
        }
        
        public void setData(ServerLoginResponse data) {
            this.data = data;
        }
        
        @Override
        public String toString() {
            return "Wrapper{" +
                    "code=" + code +
                    ", message='" + message + '\'' +
                    ", data=" + data +
                    '}';
        }
    }
    
    /**
     * User内部类，表示用户信息
     */
    public static class User {
        @SerializedName("id")
        @Expose
        private int id;             // 用户ID
        
        @SerializedName("username")
        @Expose
        private String username;    // 用户名

        @SerializedName("password")
        @Expose
        private String password;    // 密码
        
        @SerializedName("nickname")
        @Expose
        private String nickname;    // 星称
        
        @SerializedName("avatar")
        @Expose
        private String avatar;      // 头像URL
        
        @SerializedName("phone")
        @Expose
        private String phone;       // 手机号
        
        @SerializedName("email")
        @Expose
        private String email;       // 邮箱
        
        @SerializedName("gender")
        @Expose
        private String gender;      // 性别
        
        @SerializedName("birthday")
        @Expose
        private String birthday;    // 生日
        
        @SerializedName("createTime")
        @Expose
        private String createTime;  // 创建时间
        
        @SerializedName("updateTime")
        @Expose
        private String updateTime;  // 更新时间
        
        // Constructors
        public User() {
        }
        
        // Getters and Setters
        public int getId() {
            return id;
        }
        
        public void setId(int id) {
            this.id = id;
        }
        
        public String getUsername() {
            return username;
        }
        
        public void setUsername(String username) {
            this.username = username;
        }
        
        public String getPassword() {
            return password;
        }
        
        public void setPassword(String password) {
            this.password = password;
        }
        
        public String getNickname() {
            return nickname;
        }
        
        public void setNickname(String nickname) {
            this.nickname = nickname;
        }
        
        public String getAvatar() {
            return avatar;
        }
        
        public void setAvatar(String avatar) {
            this.avatar = avatar;
        }
        
        public String getPhone() {
            return phone;
        }
        
        public void setPhone(String phone) {
            this.phone = phone;
        }
        
        public String getEmail() {
            return email;
        }
        
        public void setEmail(String email) {
            this.email = email;
        }
        
        public String getGender() {
            return gender;
        }
        
        public void setGender(String gender) {
            this.gender = gender;
        }
        
        public String getBirthday() {
            return birthday;
        }
        
        public void setBirthday(String birthday) {
            this.birthday = birthday;
        }
        
        public String getCreateTime() {
            return createTime;
        }
        
        public void setCreateTime(String createTime) {
            this.createTime = createTime;
        }
        
        public String getUpdateTime() {
            return updateTime;
        }
        
        public void setUpdateTime(String updateTime) {
            this.updateTime = updateTime;
        }
        
        @Override
        public String toString() {
            return "User{" +
                    "id=" + id +
                    ", username='" + username + '\'' +
                    ", password='" + password + '\'' +
                    ", nickname='" + nickname + '\'' +
                    ", avatar='" + avatar + '\'' +
                    ", phone='" + phone + '\'' +
                    ", email='" + email + '\'' +
                    ", gender='" + gender + '\'' +
                    ", birthday='" + birthday + '\'' +
                    ", createTime='" + createTime + '\'' +
                    ", updateTime='" + updateTime + '\'' +
                    '}';
        }
    }
}